package com.gxzy.domain.entity;

import com.gxzy.config.FinalPoolCfg;
import com.gxzy.util.convert.SensitiveInfoEncryptionConvert;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @ClassName: UserSensitiveInfo
 * @Deprecated: 用户敏感信息，加密
 * @Author: 胡隆河
 * @Date: 2020/3/8 14:33
 **/

@Entity
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor                 //无参构造
@AllArgsConstructor                //有参构造
@Table(name = FinalPoolCfg.TB_USER_SENSITIVE_INFO_NAME)
@org.hibernate.annotations.Table(appliesTo = FinalPoolCfg.TB_USER_SENSITIVE_INFO_NAME, comment = "用户敏感信息，加密")
public class UserSensitiveInfo {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "snow-flake-id")
    @GenericGenerator(name = "snow-flake-id", strategy = FinalPoolCfg.CFG_GENERIC_GENERATOR_ID_PAG_PATH)
    @Column(columnDefinition = "BIGINT(20) NOT NULL COMMENT '唯一键'")
    private Long id;                                            // 主键

    @Convert(converter = SensitiveInfoEncryptionConvert.class)
    @Column(columnDefinition = "VARCHAR(50) COMMENT '真实姓名'")
    private String trueName;                                    // 真实姓名

    @Column(columnDefinition = "VARCHAR(20) COMMENT '证件类型'")
    private String cardType;                                    // 证件类型

    @Convert(converter = SensitiveInfoEncryptionConvert.class)
    @Column(columnDefinition = "VARCHAR(50) COMMENT '证件号'")
    private String cardId;                                      // 证件号

    @Convert(converter = SensitiveInfoEncryptionConvert.class)
    @Column(columnDefinition = "VARCHAR(255) COMMENT '党员信息'")
    private String partyMember;                                 // 党员信息

    @Convert(converter = SensitiveInfoEncryptionConvert.class)
    @Column(columnDefinition = "VARCHAR(50) COMMENT '党员职务'")
    private String partyWork;                                   // 党员职务

}
